package com.sky.mapper;

import com.sky.annotation.AutoFill;
import com.sky.entity.SetmealDish;
import com.sky.enumeration.OperationType;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetmealDishMapper {
    /*
    * 根据菜品id查找套餐id
    * */
    List<Long> getSetmealIdsByDishIds(List<Long> dishIds);
    /*
    * 根据dishId查询套餐表信息
    * */
    @Select("select * from setmeal_dish where dish_id = #{dishId}")
    SetmealDish getById(Long dishId);
    @AutoFill(OperationType.INSERT)
    void insertBatch(List<SetmealDish> setmealDishes);
    /*
     * 根据套餐id查找菜品id
     * */
    List<Long> getDishIdBySetmealId(List<Long> ids);

    /*
    * 删除关联表中的数据
    * */
    void deleteByIds(List<Long> ids);
    @Select("select * from  setmeal_dish where setmeal_id = #{setmealId}")
    List<SetmealDish> getByIdSetmealId(Long setmealId);
    /*
    * 删除
    * */
    @Delete("delete  from setmeal_dish where id = #{id}")
    void deleteById(Long id);
}
